package com.jrx.anytxn.transaction.job.autoPayment.step;

import com.jrx.anytxn.transaction.constant.TransBizConstant;
import com.jrx.anytxn.transaction.entity.TlPaymentLog;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.batch.MyBatisPagingItemReader;

import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 第二次批扣读
 *
 * @author : zhenghaopu
 * 2019/11/22
 */
public class AutoPaymentSecondInitReader extends MyBatisPagingItemReader<TlPaymentLog> {


    public AutoPaymentSecondInitReader(Date businessDate, SqlSessionFactory sqlSessionFactory, Integer pagesize){
        //获取批扣失败的流水
        setSaveState(false);
        setPageSize(pagesize);
        setSqlSessionFactory(sqlSessionFactory);
        setQueryId("com.jrx.anytxn.transaction.mapper.ext.ExtTlPaymentLogMapper.selectByDistinctForBatch");
        Map<String, Object> map = new HashMap<>();
        map.put("sumStatus",TransBizConstant.PAYMENT_LOG_SUM_STATUS_F);
        map.put("paymentTypeList", Arrays.asList(TransBizConstant.REPAYMENT_TYPE_AUTO));
        map.put("businessDate",businessDate);

        setParameterValues(map);
    }
}
